// apipackage/pages/api1/api1.js
Page({
  data: {
    images: [],
    markers: [{
      id: 1,
      // 117.200748,29.311144
      longitude: 117.200748,
      latitude: 29.311144,
      title: '九职大',
      height: 40,
      width: 40
    }]
  },
  handler8() {
    wx.getLocation({
      type: 'gcj02',
      success(data) {
        let longitude = data.longitude // 经度
        let latitude = data.latitude // 纬度

        // 在内置地图打开位置
        wx.openLocation({
          longitude: 117.200748,
          latitude: 29.311144,
        })
      },
      fail(err) {
        console.log(err)
      }
    })
  },
  handler7() {
    const windowInfo = wx.getWindowInfo()
    const deviceInfo = wx.getDeviceInfo()
    const systemSetting = wx.getSystemSetting()
    console.log(wx.canIUse('openBluetoothAdapter'))
  },
  handler6() {
    wx.scanCode({
      onlyFromCamera: true,
      scanType: ['qrCode'],
      success(data) {
        console.log(data.result)
      }
    })
  },
  handler5() {
    const _this = this
    wx.request({
      url: 'http://47.98.187.80:5000/api/getlunbo',
      // 请求成功的回调
      success(res) {
        _this.setData({
          images: res.data.message
        })
      },
      fail(err) {
        console.log('err', err)
      },
      complete() {
        console.log('complete')
      }
    })
  },
  handler4() {
    wx.showModal({
      title: '提示',
      content: '这是一个模态弹窗',
      success(res) {
        if (res.confirm) {
          console.log('用户点击确定')
        } else if (res.cancel) {
          console.log('用户点击取消')
        }
      }
    })
  },
  handler3() {
    wx.showActionSheet({
      itemList: ['是的', '我在想想'],
      alertText: '确认退出吗',
      success(res) {
        console.log(res.tapIndex)
      },
      fail(res) {
        console.log(res.errMsg)
      }
    })
  },
  handler1() {
    wx.showToast({
      title: '你好',
      duration: 3000,
      icon: 'loading',
      success() {
        console.log('成功')
      },
      complete() {
        console.log('完成')
      }
    })

    setTimeout(() => {
      wx.hideToast()
    }, 1000)
  },
  handler2() {
    wx.showLoading({
      title: '加载中...',
      mask: true,
    })

    setTimeout(() => {
      wx.hideLoading()
    }, 5000)
  }

})